<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>Vue 测试实例 - 菜鸟教程(runoob.com)</title>
  <!-- <script src="https://unpkg.com/vue@2.6.14/dist/vue.min.js"></script> -->
  <script src="./dist/vue.js"></script>
</head>

<body>
  <div id="app">
    <p>{{ message }}</p>
    <button v-on:click="cal">Greet</button>
  </div>

  <script>
    new Vue({
      el: '#app',
      data: {
        message: 'Hello Vue.js!',
        a:-1
      },
      methods: {
        cal: function () {
          for (let i = 0; i < 10; i++) {
            this.a = i;
            this.$nextTick(() => {
              console.log(i);
              console.log(this.a)
            })
          }
        }
      }
    })
  </script>
</body>

</html>